/**
 * 
 */
package edu.umd.clip.lm.util;

import java.util.LinkedHashMap;
import java.util.Map.Entry;

public class LRU<K,T> extends LinkedHashMap<K,T> {
	private static final long serialVersionUID = 5370611821766266799L;
	private int maxSize;
	public LRU(int initialCapacity) {
		super(initialCapacity, 1.01f, true);
		maxSize = initialCapacity;
	}
	@Override
	protected boolean removeEldestEntry(Entry<K, T> eldest) {
		return size() > maxSize;
	}
}